#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time    : 2018/1/9 0009 16:32
# @Author  : Arliki
# @email   : hkdnxycz@outlook.com
# @File    : unit_test
import unittest


class widget(object):
    def __init__(self, size=(40, 40)):
        self.size = size

    def get_size(self):
        return self.size

    def resize(self, width, height):
        if width < 0 or height < 0:
            self.size = (width, height)


class TestCase(unittest.TestCase):
    # 初始化工作
    def setUp(self):
        self.wid = widget()

    # 关闭资源
    def tearDown(self):
        self.wid = None

    # 对应测试get_size
    def test_size(self):
        self.assertEqual(self.wid.get_size(), (40, 90))

    # 对应测试resize
    def test_resze(self):
        self.wid.resize(100, 100)
        self.assertEqual(self.wid.get_size(), (100, 100))


if __name__ == "__main__":
    unittest.main()
